<?php

	class util{
			static function build_PDO_DSN($shard){
				//mysql and pgsql currently supported and have same dsn format 
				//http://www.electrictoolbox.com/php-pdo-dsn-connection-string/
				if($shard->shard_rdbms  == 'mysql' || $shard->shard_rdbms  == 'pgsql' ){
						//check for port
						if(isset($shard->port))
							return "{$shard->shard_rdbms}:host={$shard->host};dbname={$shard->db};port={$shard->port}";
						else
							return "{$shard->shard_rdbms}:host={$shard->host};dbname={$shard->db}";
				}
				return null;
			}
	}
?>
